<!-- 引入模板文件 -->
<!-- 注意：引用的是绝对路径 -->
<extend name="./Public/templete/base.html"/>    

<!-- 页面标题 -->
<block name="title"><title>Index/login</title></block>

<!-- 添加该页面对应需要的css文件 -->
<block name="link">
  <link rel="shortcut icon" src="../../../favicon.ico" />
  <link rel="stylesheet" type="text/css" href="../../../Public/source/layui/css/layui.css">
  <link rel="stylesheet" type="text/css" href="../../../Public/source/css/css3.css">
  <link href="https://cdn.bootcss.com/ionic/1.3.2/css/ionic.css" rel="stylesheet">
  <script src="https://cdn.bootcss.com/ionic/1.3.2/js/ionic.bundle.min.js"></script>
   
</block>


<!-- 右下侧的主体内容 主要内容在此处写 -->
<block name="content">
        <div class="layui-body">
            <div class="form">
               <!-- 代码从此次开始写，外层两个div不建议删除 -->
               <div class="left"> 
               <div class="layui-form-id">
                   <label class="layui-form-label">培训编号</label>
                    <div class="layui-input-inline">
                      <input type="text" name="id" class="layui-input" required>
                    </div>
               </div>
               <div class="layui-form-id">
                   <label class="layui-form-label">培训主题</label>
                    <div class="layui-input-inline">
                      <input type="text"  id="title" autocomplete="off" class="layui-input" required>
                    </div>
               </div>
               <div class="layui-form-id">
                   <label class="layui-form-label">培训类型</label>
                    <div class="layui-input-inline">
                      <select name="lei" lay-verify="" class="lei">
                        <option value="">请选择一个类型</option>
                        <option value="010">前端</option>
                        <option value="021">后台</option>
                         
                      </select>     
                    </div>
               </div>

               <div class="layui-form-id">
                 <label class="layui-form-label">日期</label>
                  <div class="layui-input-inline">
                    <input class="layui-input" id="date" type="text" placeholder="yyyy-MM-dd">
                  </div>
               </div>


               <!-- <div class="layui-form-item1">
                   <label class="layui-form-label">培训人员</label>
                    <div class="layui-input-inline">
                       <textarea id="participant" required lay-verify="required" placeholder="请输入" class="layui-textarea"></textarea>
                    </div>
               </div> -->

               <div class="layui-form-item2">
                   <label class="layui-form-label">培训大概内容</label>
                    <div class="layui-input-in">
                       <textarea id="content" required lay-verify="required" placeholder="请输入" class="layui-textarea"></textarea>
                    </div>
               </div>

               <div class="layui-form-item3">
                   <label class="layui-form-label">培训内容记录</label>
                         
                    <button type="button" class="layui-btn" id="test3" >
                      <i class="layui-icon">&#xe67c;</i>上传文件
                    </button>
               </div>
               <input type="hidden" id="savename">
               <input type="hidden" id="initname">
               <div class="layui-btn-group">
                  <button id="sub" class="layui-btn">保存</button>
                   
                   
               </div>


             </div>

             <div class="right"> 

             <div class="bar bar-header">
                <div class="h1 title">培训人员</div>
             </div>

              <div class="content has-header">

                    <ul class="list">
                      <li class="item item-checkbox">
                         <label class="checkbox">
                           <input type="checkbox" checked="">
                         </label>
                          靖涓
                      </li>
                      <li class="item item-checkbox">
                         <label class="checkbox">
                           <input type="checkbox" checked="">
                         </label>
                         游宏
                      </li>
                      <li class="item item-checkbox">
                         <label class="checkbox">
                           <input type="checkbox" checked="">
                         </label>
                         乔冰雪
                      </li>
                      <li class="item item-checkbox">
                         <label class="checkbox">
                           <input type="checkbox" checked="">
                         </label>
                         刘元旺
                      </li>
                      <li class="item item-checkbox">
                         <label class="checkbox">
                           <input type="checkbox">
                         </label>
                         刘青青
                      </li>
                    </ul>
             </div>

           </div>



                

                
              
        </div>
    </div>
</block>  





<!-- 引入或写js代码 -->
<block name="js">
  <script src="../../../Public/source/layui/layui.js"></script>
  <!-- <script src="../../Application/build/layui.js"></script> -->
  <script>
  //JavaScript代码区域
  layui.use('element', function(){
    var element = layui.element;
    
  });
</script>

<!-- <script src="/static/build/layui.js"></script> -->
<script>
layui.use('laydate', function(){
  var laydate = layui.laydate;
  
  //执行一个laydate实例
  laydate.render({
    elem: '#test1' //指定元素
  });
});
</script>


<!-- 上传图片 -->
<script>  
layui.use('upload', function(){
  var upload = layui.upload;
   
  //执行实例
  var uploadInst = upload.render({
    elem: '#test2' //绑定元素
    ,url: '' //上传接口
    ,done: function(res){
      //上传完毕回调
    }
    ,error: function(){
      //请求异常回调
    }
  });
});
</script>

<!-- 上传文件 -->
<script>  
layui.use('upload', function(){
  var upload = layui.upload;
   
  //执行实例
  var uploadInst = upload.render({
    elem: '#test3' //绑定元素
    ,url: '__URL__/upfile' //上传接口
    ,accept:'file'
    ,multiple:true
    ,done: function(res){
      $('#initname').val(res[0]);
      $('#savename').val(res[1]);
    }
    ,error: function(){
      //请求异常回调
      alert('上传失败');
    }
  });
});
</script>

<script type="text/javascript" src="../../../Public/source/jquery-3.2.1.js"></script>
<script type="text/javascript">
$(function(){
$('#sub').click(function(){
     var no1=$('#no').val();
     var date1 = $('#date').val();
     var host1=$('#host').val();
     var participant1=$('#participant').val();
     var content1=$('#content').val();
     var title1=$('#title').val();
     var type1=$('#type').val();
     var initname1=$('#initname').val();
     var savename1=$('#savename').val();
     $.ajax({
      async:true,
       type:'post',
       dataType:'json',
       url:'__URL__/tianjia1',//后台提供接口
       data:{
         no:no1, 
         date:date1,
         host:host1,
         participant:participant1,
         content:content1,
         title:title1,
         type:type1,
         initname:initname1,
         savename:savename1
       }, 
       success:function(data)
       {
           alert('添加成功');
       },
       error:function(data)
       {
        alert('添加失败')
       }
     });
   });
 })
</script>
</block>